package cn.bdqn.servlet;

import cn.bdqn.dao.HrInfoDao;
import cn.bdqn.dao.HrInfoDaoImpl;
import cn.bdqn.pojo.HrInfo;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

/**
 * @Author: 老鱼
 * @Date: 2019/1/5 14:17
 * @Description:
 */
@WebServlet(name="index",urlPatterns = {"/index"})
public class IndexServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request,
                         HttpServletResponse response)
            throws ServletException, IOException {
        request.setCharacterEncoding("utf-8");
        response.setContentType("text/html;charset=utf-8");

        //
        HrInfoDao dao=new HrInfoDaoImpl();
        List<HrInfo> infoList=dao.hrInfoList();

        //
        request.setAttribute("lists",infoList);
        request.getRequestDispatcher("index.jsp").forward(request,response);

    }
}
